<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('details列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>业务id：</label>
                                <input type="text" name="businessId"/>
                            </li>
                            <li>
                                <label>用户名称：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>批次：</label>
                                <input type="text" name="batch"/>
                            </li>
                            <li>
                                <label>用户：</label>
                                <input type="text" name="userCard"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:details:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:details:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-primary" onclick="getsuccess()">
                    <i class="fa fa-cny"></i> 查询成功数据
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('execution:details:edit')}]];
        var removeFlag = [[${@permission.hasPermi('execution:details:remove')}]];
        var prefix = ctx + "execution/details";
        var cookie = ''
        var flag = 0
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "details",
                sortName: "receivedTime",
                sortOrder: "desc",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'businessId',
                    title: '业务id'
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'batch',
                    title: '批次'
                },
                    {
                        field: 'createTime',
                        title: '执行时间'
                    },
                    {
                        field: 'receivedTime',
                        title: '最近一次扣款时间'
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function getsuccess() {
            let lock = false
            layer.prompt({title: '请输入Cookie', formType: 2}, function(text, index){
                layer.close(index);
                cookie = text.replace(/^\s+|\s+$/g, '')
                console.log(cookie)
                lock = true;
                if (lock){
                    $.modal.loading("正在查询成功数据，请稍后...");
                    $.ajax({
                        url: "/api/new/screen",
                        type: "post",
                        data:{
                            "cookie":cookie
                        },
                        success: res => {
                            console.log("成功")
                            console.log(res)
                            $.modal.closeLoading();
                            if(res.code=="200"){
                                $.modal.confirm(res.msg, function() {
                                    $.modal.msgReload("操作成功！正在刷新数据", modal_status.SUCCESS);
                                });
                            }else if(res.code=="500"){
                                $.modal.confirm(res.msg, function() {
                                    $.modal.msgReload("正在刷新数据", modal_status.SUCCESS);
                                });

                            }
                        }
                    })

                }
            });
        }
    </script>
</body>
</html>